#!/bin/bash
cmds=( 
    "ros2 run ros1_bridge dynamic_bridge --bridge-all-1to2-topics"
    "ros2 launch hnurm_bringup tf_transformer.launch.py"
    "echo ' '|sudo -S chmod 777 /dev/ttyUSB0"
    "ros2 launch ldlidar_stl_ros2 ld06.launch.py"
    # #后视相机
    # "ros2 launch usb_cam camera.launch.py"  
    # #vision
    # "ros2 launch hnurm_camera hnurm_camera.launch.py"
    # "ros2 launch hnurm_detect hnurm_detect.launch.py"
    # "ros2 launch hnurm_armor hnurm_armor.launch.py"
    #uart serial
    "ros2 launch hnurm_uart hnurm_uart.launch.py"
    #navigation
    "echo ' '|sudo -S rm -rf /tmp/livo2_pcd/all_raw_points.pcd"
    "echo ' '|sudo -S touch /tmp/livo2_pcd/all_raw_points.pcd"
    "echo ' '|sudo -S chmod 777 /tmp/livo2_pcd/all_raw_points.pcd"
    "echo ' '|sudo -S docker run --rm --net host --env DISPLAY=\$DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix --volume /dev:/dev --volume /tmp/livo2_pcd:/tmp/livo2_pcd --privileged livo2:latest bash -c 'source ~/.bashrc && roslaunch fast_livo maping_mid360.launch rviz:=0 img_en:=0 save_pcd:=true'"
    "ros2 launch hnurm_bringup test.launch.py"
 
    
)
for cmd in "${cmds[@]}"
do
    echo Current CMD : "$cmd"
    gnome-terminal -- bash -c "cd $(pwd);source ~/ros-humble-ros1-bridge/install/local_setup.bash;source /home/rm/nav/install/setup.bash;$cmd;exec bash;"
    sleep 0.3 
done
sleep 5.0


cmds_nav=( 
    "ros2 launch hnurm_navigation online_async_launch.py"
	"ros2 launch hnurm_navigation bringup_no_amcl_launch.py"
)
for idx in "${cmds_nav[@]}"
do
    echo Current CMD : "$idx"
    gnome-terminal -- bash -c "cd $(pwd);source /home/rm/nav/install/setup.bash;$idx;exec bash;"
    sleep 4.0
done

